package com.pipi.biyesheji.dao.manager.impl;

import com.pipi.biyesheji.dao.support.PageResult;
import com.pipi.biyesheji.dao.model.UserRoleDO;
import com.pipi.biyesheji.dao.query.UserRoleQuery;
import com.pipi.biyesheji.dao.mapper.ext.UserRoleExtMapper;
import com.pipi.biyesheji.dao.manager.UserRoleManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for UserRole.
 */

@Component
public class UserRoleManagerImpl implements UserRoleManager{

    
    @Autowired
    protected UserRoleExtMapper userRoleExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(UserRoleQuery query){
        return userRoleExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(UserRoleQuery query){
        return userRoleExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(Long id){
        return userRoleExtMapper.deleteByPrimaryKey(id);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(UserRoleDO record){
        return userRoleExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<UserRoleDO> selectByQuery(UserRoleQuery query){
        return userRoleExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<UserRoleDO> selectByQueryWithPage(UserRoleQuery query) {
        PageResult<UserRoleDO> result = new PageResult<UserRoleDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public UserRoleDO selectByPrimaryKey(Long id){
        return userRoleExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( UserRoleDO record,  UserRoleQuery query){
        return userRoleExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( UserRoleDO record,  UserRoleQuery query){

        return userRoleExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(UserRoleDO record){
        return userRoleExtMapper.updateByPrimaryKeySelective(record);
    }
}